﻿@using LunwenYun.Infrastructure.Entities.Entity;
@using LunwenYun.Infrastructure.Entities.Enum;
@{
    Layout = "/Views/Shared/_o_Main.cshtml";
    User user = new User().Find(HttpContext.Current.User.Identity.Name);
}
<div class="container">
    <div class="row">
        <div class="span3">
            <ul class="nav nav-tabs nav-stacked">
                <li class="active"><a href="/o/authorcenter"><i class="icon-user"></i><strong>个人中心</strong></a></li>
                <li class="active"><a href="/o/authorcenter">约稿稿件</a></li> 
                <li><a href="/o/myorders">我的约稿 
                @if (ViewBag.OrderCount > 0)
                    {
                        <span class="badge badge-warning">@ViewBag.OrderCount</span>
                    }
                </a></li>
                @if (user.Industry > 0)
                {
                <li><a href="/o/industryorders">我的行业约稿</a></li>
                }
                <li><a href="/o/profile">约稿人信息</a></li>
                <li><a href="/o/resetpassword">修改密码</a></li>
            </ul>
        </div>
        <div class="span9">
            <blockquote>
                <p>
                    <strong>约稿稿件</strong></p>
                <small>您可以在此查看您所有您代理期刊的意向投稿情况。</small>
            </blockquote>
            <table class="table table-hover">
                <tbody>
                    @{
                        ItemListBox<Article> list = ViewBag.Data;
                        if (list != null && list.Data != null && list.Data.Any())
                        {
                            foreach (var item in list.Data)
                            {
                        <tr>
                            <td>
                                <div class="pull-left">
                                    <div class="doc">
                                        <img alt="doc" src="/content/img/doc.png" /></div>
                                </div>
                                <div class="pull-left">
                                    <h5>
                                        <a target="_blank" href="/j/article/@item.Id">@item.Title</a></h5>
                                    <p>
                                        <strong>分类：</strong>@item.IndType.Mapping() -> @item.SubIndType.Mapping()<br />
                                        <strong>方向：</strong>
                                        @if (!String.IsNullOrEmpty(item.Aptitude))
                                        {
                                            string aptString = string.Empty;
                                            List<string> apt = item.Aptitude.Split(';').Where(c => !String.IsNullOrEmpty(c)).ToList();
                                            foreach (var aptitem in apt)
                                            {
                                                try
                                                {
                                                    int iapt = Int32.Parse(aptitem);
                                                    aptString += ((Aptitude)iapt).Mapping() + "、";
                                                }
                                                catch { }
                                            }
                                            aptString = aptString.EndsWith(";") ?
                                                aptString.Remove(aptString.Length) : aptString;
                                            <span>@aptString @item.Language.Mapping()</span>
                                        }
                                        <br />
                                        <strong>预算：</strong>@item.PriceRange<br />
                                        <strong>意向期刊：</strong>《@item.Periodical.Name》<br />
                                        <strong>意向发布时间：</strong>@item.CreateTime.ToString("yyyy-MM-dd HH:mm")
                                        </p>
                                </div>
                            </td>
                            <td style="width: 20%; text-align: right" class="center">
                                @if (item.Status == ArticleStatus.Complete)
                                {
                                    <input type="button" disabled="disabled" class="btn btn-success btn-mini" value="已完成" />
                                }
                                else if (item.ExpireTime < DateTime.Now)
                                {
                                    <input type="button" disabled="disabled" class="btn btn-inverse btn-mini" value="已结束" />
                                }
                                else
                                {
                                    <a target="_blank" href="/j/article/@item.Id" class="btn btn-primary btn-mini">点击查看</a>
                                    <a href="/o/launch/@item.Id" target="_blank" class="btn btn-info btn-mini">发起约稿</a>
                                }
                            </td>
                        </tr>
                            }
                        }
                    }
                </tbody>
            </table>
        </div>
        @Html.Raw(list.PageItemSegment)
    </div>
</div>
@section tail
{
    @if(!new User().Find(HttpContext.Current.User.Identity.Name).IsComplete)
    {
        <script type="text/javascript" src="/Scripts/plug.js"></script>
        <script type="text/javascript">
            $(function () {
                new plug.MessageBox().Show('您还未完善您的约稿人信息，请您尽快完善！<br/><br/>',
                    '<a href="/o/profile" class="btn btn-primary btn-mini">立即完善</a>',
                    '<a href="javascript:;" style="margin-left:10px;" class="btn btn-mini" id="btnplugmsgboxclose">稍后完善</a>',
                    'btnplugmsgboxclose');
            });
        </script>
    }
    <script type="text/javascript">
        $(function () {
            $('#likcenter').addClass('active');
        }); </script>
}